/* Begin KR - C3 */

#ifndef OTHERKR_H
#define OTHERKR_H

#include <string>
#include <vector>
#include "Category.h"
#include "Product.h"
#include "Customer.h"
#include "Cart.h"
#include "Cart_item.h"

using namespace std;

class OtherKR {
public:
        /* Will write category and product from vector to the file */
        static void writeProducts(string const& path, vector<Category> const& categories, vector<Product> const& products);

        /* Will write customer data from vector to the file */
        static void writeCustomers(string const& path, vector<Customer> const& customers);

        /* Will write cart and cart item data from vector to the file */
        static void writeCarts(string const& path, vector<Cart> const& carts, vector<Cart_item> const& items, vector<Product> const& products);
protected:
        /* Check whether a cart item refer to existing product or not */
        static bool isCartItemValid(Cart_item item, vector<Product> products);

        /* Check whether a cart has at least one cart item */
        static bool isCartValid(Cart cart, vector<Cart_item> items);

        /* Check whether the product price is more than zero */
        static bool isProductValid(Product prod);
};

#endif
